<script setup>
import { useRouter } from 'vue-router'

const router = useRouter()
defineProps({
  data: {}
})
</script>
<template>
  <div class="topic">
    <div class="wrapper">
      <div class="title">
        <div class="left">
          <h3>最新上架</h3>
        </div>
        <div class="right">
          <span class="more" @click="router.push('/goods/channel')"
            >查看全部<span class="iconfont icon-arrow-right-bold"></span
          ></span>
        </div>
      </div>
    </div>
  </div>
  <div class="topic_bd">
    <ul>
      <el-row>
        <li v-for="item in data" :key="item.id">
          <a
            :href="
              router.resolve({
                name: 'goodsDetail',
                params: { id: item.id }
              }).href
            "
            target="_blank"
            rel="noopener noreferrer"
          >
            <div class="pic">
              <img :src="item.image" alt="无" />
              <div class="info">
                <div class="left">
                  <h5
                    style="
                      max-width: 250px;
                      overflow: hidden;
                      text-overflow: ellipsis;
                      white-space: nowrap;
                    "
                  >
                    {{ item.description }}
                  </h5>
                  <p>卖家：{{ item.sellerName }}</p>
                </div>
                <div class="right">
                  ¥<span>{{ item.price }}</span>
                </div>
              </div>
            </div>
          </a>
          <div class="txt">
            <div class="left">
              <p>
                <span class="iconfont icon-favorites-fill red"></span>
                <i>1200</i>
              </p>
              <p>
                <span class="iconfont icon-browse"></span>
                <i>1800</i>
              </p>
            </div>
            <div class="right">
              <i>名称:{{ item.name }}</i>
            </div>
          </div>
        </li>
      </el-row>
    </ul>
  </div>
</template>
<style scoped lang="scss">
.topic {
  width: 100%;
  padding-top: 50px;
  font-weight: 800;
  background-color: #f1f1f1;
  box-shadow: 0 0 5px #ddd;
  .wrapper {
    width: 1526px;
    margin: 0 auto;
  }
}
.topic .title {
  padding: 0 40px;
}
.topic_bd {
  width: 1526px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 40px;
}
.topic_bd ul {
  display: flex;
  justify-content: space-between;
}
.topic_bd li {
  width: 370px;
  height: 355px;
  margin-right: 40px;
}
.topic_bd .pic {
  position: relative;
  width: 405px;
  height: 288px;
}
.topic_bd .txt {
  display: flex;
  justify-content: space-between;
  padding: 0 15px;
  height: 67px;
  line-height: 67px;
  color: #666;
  font-size: 14px;
}
.topic_bd .txt .left {
  display: flex;
}
.topic_bd .txt .left p {
  margin-right: 20px;
}
.topic_bd .txt .left .red {
  color: #aa2113;
}
.topic_bd .info {
  position: absolute;
  left: 0;
  bottom: 0;
  display: flex;
  justify-content: space-between;
  padding: 0 15px;
  width: 100%;
  height: 90px;
  background-image: linear-gradient(
    180deg,
    rgba(137, 137, 137, 0) 0%,
    rgba(0, 0, 0, 0.9) 100%
  );
}
.topic_bd .info .left {
  padding-top: 20px;
  color: #fff;
}
.topic_bd .info .left h5 {
  margin-bottom: 5px;
  font-size: 20px;
}
.topic_bd .info .right {
  margin-top: 35px;
  padding: 0 7px;
  height: 25px;
  line-height: 25px;
  background-color: #fff;
  color: #aa2113;
  font-size: 15px;
}
</style>
